package com.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author Yadasu
 * @date 2021/1/15 13:36
 */
@Data
@Entity
@Table(name = "sys_project")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SysProject implements Serializable {
    private static final long serialVersionUID = -4311864344397594390L;


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "项目表id")
    private Integer id;
    @Column(name = "project_name")
    @ApiModelProperty(value = "项目表名")
    private String projectName;
    @Column(name = "developer_name")
    @ApiModelProperty(value = "开发人员名")
    private String developerName;

    @Column(name = "update_time")
    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "项目状态信息")
    private Integer status;


    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name="sys_project_version",//中间表的名称
            //中间表user_role字段关联sysuser表的主键字段id
            joinColumns={@JoinColumn(name="project_id",referencedColumnName="id")},
            //中间表user_role的字段关联sysrole表的主键id
            inverseJoinColumns={@JoinColumn(name="deploy_id",referencedColumnName="deploy_id")}
    )
    private List<SysVersionManage> manages;

}
